<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 400px;
            height: 400px;
        }
    </style>
</head>

<body>
    <div id="app">
        <button @click="add">添加数据</button>
        <button @click="del">删除数据</button>
        <ul>
            <li v-for="(item,index) in arr" :key="item">{{index+1}}加油{{item}}</li>
        </ul>
        <h2 v-for="key in obj" :title="key.name">{{key.name}}</h2>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                arr: [1, 2, 3, 4],
                obj: [{
                        name: "aa",
                    },
                    {
                        name: "bb"
                    }
                ]
            },
            methods: {
                add() {
                    this.obj.push({
                        name: "cc"
                    })
                },
                del() {
                    this.obj.shift()
                }
            }

        })
    </script>
</body>

</html>